/*
 *  testsphere.cpp
 *  Ray Tracing
 *
 *  Created by Jean-Marc Comby + Romain Dequesne on Sat May 01 2004.
 *  Copyright (c) 2004. All rights reserved.
 *
 */

#include "testsphere.hpp"

void afficheS()
{
	//titre
	std::cout<<"- Test de la classe Sphere -"<<std::endl<<std::endl;
	//definitions
	std::vector<Coord> Origine; //specs des rayons
	std::vector<VecteurU> Direction;
	std::vector<Coord> Centre; //specs des spheres
	std::vector<double> Ray;
	//init des coord de l'origine
	Origine.push_back(Coord(0,0,-1));
	Origine.push_back(Coord(1,1,0));
	Origine.push_back(Coord(1,1,0));
	Origine.push_back(Coord(1,1,0));
	Origine.push_back(Coord(1,1,0));
	//init des directions
	Direction.push_back(VecteurU(0,0,1));
	Direction.push_back(VecteurU(0,0,1));
	Direction.push_back(VecteurU(0,0,1));
	Direction.push_back(VecteurU(0,0,1));
	Direction.push_back(VecteurU(0,0,1));
	//init des coord des centres
	Centre.push_back(Coord(0,0,1));
	Centre.push_back(Coord(-2,-2,1));
	Centre.push_back(Coord(-2,-2,1));
	Centre.push_back(Coord(-2,-2,1));
	Centre.push_back(Coord(-2,-2,1));
	//init des rayons
	Ray.push_back(1.0);
	Ray.push_back(5.0);
	Ray.push_back(4.3);
	Ray.push_back(std::sqrt(18.0));
	Ray.push_back(4.0);
	//affichage des tests
	Coord nointers(-1);
	for (unsigned int i(0); i<Origine.size();i++)
	{
		Sphere temps(Centre[i],Ray[i]);
		Rayon tempr(Origine[i], Direction[i]);
		Coord tmp(temps.intersect(tempr));
		if (tmp==nointers)
			std::cout<<"pas d'intersection"<<std::endl;
		else
			tmp.affiche();
	}
	std::cout<<std::endl<<std::endl;
}
